package se.webbzon.boltzmann.battle.round;

import se.webbzon.boltzmann.battle.battleaction.BattleAction;
import se.webbzon.boltzmann.battle.battleaction.BattleActionListener;
import se.webbzon.oschi01.friendly.Friendly;

/** An implementation of a battle action listener used to listen to battle
 * actions caused by a strategy. **/
@Friendly class BattleRoundStrategyActionListener implements BattleActionListener {
	
	// The battle round associated with this listener
	private final BattleRound round;
			
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new strategy battle action listener. **/
	@Friendly BattleRoundStrategyActionListener(BattleRound round) {
		this.round = round;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	@Override public void onBegin(BattleAction battleAction) {
		
	}

	@Override public void onEnd(BattleAction battleAction) {
		if (!round.checkAndNotifyVictory(true))
			round.endTurn();
	}
	
}